#ifndef __WIZ_BASE_CORE_TYPE_INT_HPP__SHANHAOBO_19800429__
#define __WIZ_BASE_CORE_TYPE_INT_HPP__SHANHAOBO_19800429__

////////////////////////////////////////////////////////////////////////////

#include "../../../Config/WizConfig.hpp"
#include "./WizBaseCoreDeclare.hpp"

namespace Wiz
{
    namespace __Inner__
    {
        ///====================================///
#   if (WIZ_CFG_COMPILER == WIZ_CFG_COMPILER_MSVC)
        namespace Int8
        {
            typedef __int8              Type;
        }
        namespace UInt8
        {
            typedef unsigned __int8     Type;
        }
        namespace Int16
        {
            typedef __int16             Type;
        }
        namespace UInt16
        {
            typedef unsigned __int16    Type;
        }
        namespace Int32
        {
            typedef __int32             Type;
        }
        namespace UInt32
        {
            typedef unsigned __int32    Type;
        }
        namespace Int64
        {
            typedef __int64             Type;
        }
        namespace UInt64
        {
            typedef unsigned __int64    Type;
        }
#   elif (WIZ_CFG_COMPILER == WIZ_CFG_COMPILER_GNUC)
#       include <inttypes.h>
        namespace Int8
        {
            typedef ::int8_t            Type;
        }
        namespace UInt8
        {
            typedef ::uint8_t           Type;
        }
        namespace Int16
        {
            typedef ::int16_t           Type;
        }
        namespace UInt16
        {
            typedef ::uint16_t          Type;
        }
        namespace Int32
        {
            typedef ::int32_t           Type;
        }
        namespace UInt32
        {
            typedef ::uint32_t          Type;
        }
        namespace Int64
        {
            typedef ::int64_t           Type;
        }
        namespace UInt64
        {
            typedef ::uint64_t          Type;
        }
#   else
#       error Illegal compiler
#   endif /*#if (WIZ_COMPILER == WIZ_COMPILER_MSVC)*/
        ///====================================///

        namespace Int
        {
            typedef int                 Type;
        }
        namespace UInt
        {
            typedef unsigned int        Type;
        }
    } /// end of namespace __Inner__

#   define WIZ_MIN_INT(t) ((t)(((t)1) << ((sizeof(t) << 3) - 1)))
#   define WIZ_MAX_INT(t) ((t)(~(WIZ_MIN_INT(t))))
#   define WIZ_MIN_UINT(t) ((t)0)
#   define WIZ_MAX_UINT(t) ((t)(~(WIZ_MIN_UINT(t))))

#   define WIZ_MINMAX_INT(t)                   \
    static const t Min = WIZ_MIN_INT(t);       \
    static const t Max = WIZ_MAX_INT(t);

#   define WIZ_MINMAX_UINT(t)                   \
    static const t Min = WIZ_MIN_UINT(t);       \
    static const t Max = WIZ_MAX_UINT(t);

    namespace Int8
    {
        WIZ_DECLARE(::Wiz::__Inner__::Int8::Type);
        WIZ_MINMAX_INT(::Wiz::__Inner__::Int8::Type);
    } /// end of namespace Int8
    namespace UInt8
    {
        WIZ_DECLARE(::Wiz::__Inner__::UInt8::Type);
        WIZ_MINMAX_UINT(::Wiz::__Inner__::UInt8::Type);
    } /// end of namespace UInt8

    namespace Int16
    {
        WIZ_DECLARE(::Wiz::__Inner__::Int16::Type);
        WIZ_MINMAX_INT(::Wiz::__Inner__::Int16::Type);
    } /// end of namespace Int16
    namespace UInt16
    {
        WIZ_DECLARE(::Wiz::__Inner__::UInt16::Type);
        WIZ_MINMAX_UINT(::Wiz::__Inner__::UInt16::Type);
    } /// end of namespace UInt16

    namespace Int32
    {
        WIZ_DECLARE(::Wiz::__Inner__::Int32::Type);
        WIZ_MINMAX_INT(::Wiz::__Inner__::Int32::Type);
    } /// end of namespace Int32
    namespace UInt32
    {
        WIZ_DECLARE(::Wiz::__Inner__::UInt32::Type);
        WIZ_MINMAX_UINT(::Wiz::__Inner__::UInt32::Type);
    } /// end of namespace UInt32

    namespace Int64
    {
        WIZ_DECLARE(::Wiz::__Inner__::Int64::Type);
        WIZ_MINMAX_INT(::Wiz::__Inner__::Int64::Type);
    } /// end of namespace Int64
    namespace UInt64
    {
        WIZ_DECLARE(::Wiz::__Inner__::UInt64::Type);
        WIZ_MINMAX_UINT(::Wiz::__Inner__::UInt64::Type);
    } /// end of namespace UInt64

    namespace Int
    {
        WIZ_DECLARE(::Wiz::__Inner__::Int::Type);
        WIZ_MINMAX_INT(::Wiz::__Inner__::Int::Type);
    } /// end of namespace Int
    namespace UInt
    {
        WIZ_DECLARE(::Wiz::__Inner__::UInt::Type);
        WIZ_MINMAX_UINT(::Wiz::__Inner__::UInt::Type);
    } /// end of namespace UInt
} /// end of namespace Wiz

////////////////////////////////////////////////////////////////////////////

#endif /*__WIZ_BASE_CORE_TYPE_INT_HPP__SHANHAOBO_19800429__*/
